package com.grf.controller;

import com.grf.pojo.User;
import com.grf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class UserController {

    @Autowired
    UserService userService;

    @ResponseBody
    @RequestMapping("/getUser")
    public User getUser() {
        User user = userService.getUserByName("grf");
        if (null == user) {
            user = new User();
            user.setId("-1");
            user.setUserName("用户不存在");
        }
        return user;
    }

}
